using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spinning.Spinning.Unitity;
using Box2D.XNA;
using Microsoft.Xna.Framework;
using Spinning.Spinning.Entity.Particle;

namespace Spinning.Spinning.Entity.Particle
{
    class Marble : ParticleActor
    {

        public Marble() : base() {
            Physic_Type = PhysicType.Marble;
            ZIndex = Constants.marble;
            Reset();
        }

        public override void Reset()
        {
            base.Reset();
            Alpha = 1;
        }

        public override void OnCreatBody(World world, PhysicConnectManager connectManager)
        {
            base.OnCreatBody(world, connectManager);
            Filter filter = new Filter();
            filter.categoryBits = (ushort)Constants.CategoryBitsMarble;
            filter.maskBits = (ushort)Constants.MaskBitsMarble;
            Filter = filter;
            _fixture.SetRestitution(2);
            _fixture.SetDensity(Constants.enemyDensity);
        }

        public override void BeginContact(PhysicSprite other)
        {
            base.BeginContact(other);
           
            if (other.Physic_Type == PhysicType.Enemy)
            {
                isHit = true;
                isDead = true;
            }
        }

    }
}
